;(function() {
		init_parsley();
		$("#sync_data").click(function () {
            $.post(
                "/operation/shop/syncShop",
				{
					id : $('#shop_id').val()
				},
                function(data){
                    if(data.flag){
                        $("#myModal").modal("hide");
                        toastr['success'](data.msg, '同步成功！');
                        $("#myform #btn-advanced-refresh").trigger("click");// 刷新页面
                    }else{
                        toastr['error'](data.msg,"操作失败！");
                    }
                }
            );
        });
	   	$("#form-submit").click(function(){
	   		var flag=$('#validate-form').parsley('validate' );
	   		if(flag){
	   			$.post(
	   				"/operation/shop/editPost",
	   				$("#validate-form").serialize(),
	   				function(data){
			      		if(data.flag){
			      			$("#myModal").modal("hide");
			      			toastr['success']("操作成功！", ''); 
			      			$("#myform #btn-advanced-refresh").trigger("click");// 刷新页面
			      		}else{
			      		 	toastr['error'](data.msg,"操作失败！"); 
			      		}
	   				}
	   			);
	   		}
	   	});
    $('.datepicker').datepicker({format: 'yyyy-mm-dd',todayHighlight:true,clearBtn:true,autoclose:true , language:"zh-CN"});
})();